package com.j283_5.wisdom_park.vo.device_management;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.j283_5.wisdom_park.pojo.Device;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author wsir
 * @create 2022-04-30-15:36
 */
@AllArgsConstructor
@NoArgsConstructor
@ToString

public class DeviceVo implements Serializable {
    /**
     * 设备信息id
     */
    @TableId(value = "dinf_id", type = IdType.AUTO)
    private Integer dinfId;

    /**
     * 设备名称
     */
    private String ddetName;

    /**
     * 设备编号
     */
    private String ddetNumber;

    /**
     * 设备型号
     */
    private String ddetType;

    /**
     * 设备出厂时间
     */
    private Timestamp ddetFactorydate;

    /**
     * 0:正常，1：为禁用2：异常
     */
    private String dinfState;

    /**
     * 跟进人
     */
    private String adminName;

    /**
     * 跟进人电话
     */
    private String adminPhone;

    /**
     * 安装位置
     */
    private String dinfLocation;


    /**
     * 设备照片
     */
    private String dinfDevicephoto;

    /**
     * 现场照片
     */
    private String dinfLivephoto;

    /**
     * 厂家
     */
    private String ddetFactory;

    /**
     * 版本号
     */
    private String ddetVersion;
    /**
     * 设备类型名称
     */
    private String ddetStyle;
    /**
     * adminId
     */
    private Integer adminId;
    /**
     * ddetId
     */
    private Integer ddetId;

    public Integer getAdminId() {
        return adminId;
    }

    public void setAdminId(Integer adminId) {
        this.adminId = adminId;
    }

    public Integer getDdetId() {
        return ddetId;
    }

    public void setDdetId(Integer ddetId) {
        this.ddetId = ddetId;
    }

    public DeviceVo(Device device) {
        this.dinfId = device.getDinfId();
        this.ddetName = device.getDdetName();
        this.ddetNumber = device.getDdetNumber();
        this.ddetType = device.getDdetType();
        this.ddetFactorydate = device.getDdetFactorydate();
        this.adminId = device.getAdminId();
        this.ddetId = device.getDdetId();
        if (device.getDinfState() != null) {
            setDinfState(device.getDinfState());
        }
        this.adminName = device.getAdminName();
        this.adminPhone = device.getAdminPhone();
        this.dinfLocation = device.getDinfLocation();
        this.dinfDevicephoto = device.getDinfDevicephoto();
        this.dinfLivephoto = device.getDinfLivephoto();
        this.ddetStyle = device.getDdetStyle();
        this.ddetFactory = device.getDdetFactory();
        this.ddetVersion = device.getDdetVersion();
    }

    public void setDinfState(Integer dinfState) {
        switch (dinfState) {
            case 0:
                this.dinfState = "正常";
                return;
            case 1:
                this.dinfState = "禁用";
                return;
            case 2:
                this.dinfState = "异常";
                return;
            default:
                this.dinfState = "异常";
        }
    }

    public String getDdetFactory() {
        return ddetFactory;
    }

    public void setDdetFactory(String ddetFactory) {
        this.ddetFactory = ddetFactory;
    }

    public String getDdetVersion() {
        return ddetVersion;
    }

    public void setDdetVersion(String ddetVersion) {
        this.ddetVersion = ddetVersion;
    }

    public Integer getDinfId() {
        return dinfId;
    }

    public void setDinfId(Integer dinfId) {
        this.dinfId = dinfId;
    }

    public String getDdetName() {
        return ddetName;
    }

    public void setDdetName(String ddetName) {
        this.ddetName = ddetName;
    }

    public String getDdetNumber() {
        return ddetNumber;
    }

    public void setDdetNumber(String ddetNumber) {
        this.ddetNumber = ddetNumber;
    }

    public String getDdetType() {
        return ddetType;
    }

    public void setDdetType(String ddetType) {
        this.ddetType = ddetType;
    }

    public Timestamp getDdetFactorydate() {
        return ddetFactorydate;
    }

    public void setDdetFactorydate(Timestamp ddetFactorydate) {
        this.ddetFactorydate = ddetFactorydate;
    }

    public String getDinfState() {
        return dinfState;
    }

    public void setDinfState(String dinfState) {
        this.dinfState = dinfState;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public String getAdminPhone() {
        return adminPhone;
    }

    public void setAdminPhone(String adminPhone) {
        this.adminPhone = adminPhone;
    }

    public String getDinfLocation() {
        return dinfLocation;
    }

    public void setDinfLocation(String dinfLocation) {
        this.dinfLocation = dinfLocation;
    }

    public String getDinfDevicephoto() {
        return dinfDevicephoto;
    }

    public void setDinfDevicephoto(String dinfDevicephoto) {
        this.dinfDevicephoto = dinfDevicephoto;
    }

    public String getDinfLivephoto() {
        return dinfLivephoto;
    }

    public void setDinfLivephoto(String dinfLivephoto) {
        this.dinfLivephoto = dinfLivephoto;
    }

    public String getDdetStyle() {
        return ddetStyle;
    }

    public void setDdetStyle(String ddetStyle) {
        this.ddetStyle = ddetStyle;
    }
}
